<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'Feeling better',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2017/12/21.jpg" alt="Small bush covered in bracket fungi" class="framed-centred-image" width="800" height="480"/>
<section id="general">
	<h2>General news</h2>
	<p>
		I feel so much better this morning.
		Just like last time.
		Again, I don&apos;t feel better than before I had my teeth pulled, but I feel better than the rest of the day following the experience.
		Last time, I had two holes in my gums on the one side.
		This time, I can&apos;t feel any holes, but rather, one long seam.
		It&apos;s like the part of the gums between the extracted teeth was removed and the sides remaining were pressed together.
		I&apos;m not sure what&apos;s holding them together, but I&apos;m not going to pull at it and find out.
	</p>
	<p>
		The syringe-rinsing thing isn&apos;t working out though.
		On the site of the initial surgery, it seemed to be sealed over.
		The instructions said I should rinse it out once a day with a syringe after a week of letting it heal ...
		It&apos;s not been three weeks since the surgery, so it&apos;s not yet time to stop rinsing.
		I tried to find a gap to stick the syringe in, as it couldn&apos;t possibly be heal over yet ...
		But all I did was make it bleed.
		I think it had indeed healed shut, and I ripped it back open.
		The other side feels closed already.
		I doubt it&apos;s actually healed shut yet, but by the time I&apos;m supposed to <strong>*start*</strong> rinsing that side with the syringe, it will be.
		That is, unless the upcoming surgery mangles it badly enough that it doesn&apos;t close up nicely right away like it did this time.
		I&apos;m going to just ignore the syringe instructions.
		They don&apos;t seem to be fit for my particular case, and I seem to be healing fine on the side I wasn&apos;t able to start rinsing as soon as directed anyway.
	</p>
</section>
<section id="dreams">
	<h2>Dream journal</h2>
	<p>
		I dreamed my mother was taking each of her children through a department store, one by one, to pick out presents to receive from her for the holidays.
		I&apos;m atheist, so none of these winter holidays mean a thing to me.
		Furthermore, they&apos;re obligatory gift days, and I feel gifts given on such days lose all meaning behind them because they&apos;re given not out of love, but out of obligation.
		My mother&apos;s Christian though, and she disagrees with my opibion on the gifts being meaningless.
	</p>
	<p>
		Anyway, every year, my mother tries to get everyone to tell her what they want to receive from her, but she usually refuses to tell what she wants herself because she doesn&apos;t really want anything.
		I mean, she wants to receive <strong>*something*</strong>, but has no clue what.
		Last year, after I made up a gift for her to give me, she again wouldn&apos;t tell me anything right away.
		Eventually, she found a gift she wanted, told some of her children but not me, forgot which children she&apos;d told, and assumed she&apos;d told them all.
		Later, I refused a gift from her (which wasn&apos;t at all what I&apos;d asked for) because she&apos;d never told me what she wanted, and she claimed she&apos;d thought she&apos;d already told me.
		She couldn&apos;t recall what it was though.
		
		She tried to pull that garbage again this year, but I&apos;m done with it.
		I said I&apos;d tell her what I want <strong>*after*</strong> she tells me what she wants.
		It doesn&apos;t matter what I tell her to be honest though, as whatever I tell her I want is exactly what she won&apos;t give.
		It happens every time.
	</p>
	<p>
		Anyway, it was my turn to go through the store with her.
		She asked me to help her look for stuff that wasn&apos;t on sale.
		She&apos;d not yet mentioned anything about gifts, but I knew she was saying she didn&apos;t want me to pick out something inexpensive just to save her money.
		As she hadn&apos;t actually given me anything besides that the items shouldn&apos;t be on sale, I started pointing out whatever items I could find without sale prices.
		It was pretty obvious I had no interest on most of these items, such as a trampoline and a fire extinguisher.
		She seemed unphased, like this was what she was actually after from me.
		I was waiting for her to ask me what I wanted though, so I could remind her that she wasn&apos;t getting anything out of me this year until she coughs up information about what she wants herself.
		She got distracted by the fire extinguishers though ...
		They had strange and confusing price tags, but she wanted one.
		I tried to help decipher them, as I could understand what the prices meant, but she rudely told me to be quiet, so I let her deal with that on her own.
		I woke up before she got anywhere on that front though.
	</p>
</section>
<section id="university">
	<h2>University life</h2>
	<p>
		In today&apos;s discussion post, I was able to bring up the university&apos;s censorship of my website, as it was actually relevant.
		I needed to talk about hardware interrupts, but I was unable to point to my notes on them.
		I used to link to my past assignments when they were relevant.
		In fact, I had to reformat my learning journal entries to make them easier to link to, as at one point, I needed to link to a learning journal assignment.
		I can&apos;t do that any more now though, as the school has demanded that I take down my work.
		Anyway, my discussion post for the day was as follows:
	</p>
	<blockquote>
		<h3>In the description of the Hack machine language in chapter 4, it is stated that in well-written programs a C-instruction that may cause a jump should not contain a reference to M, and vice versa. Discuss why this should be avoided.</h3>
		<p>
			&quot;M&quot; is a notation used to refer to the value stored in memory at the address specified in the A register.
			When we refer to &quot;M&quot;, M&apos;s value is dependant on which address we have stored.
			A jump instruction likewise uses the value stored in the A register as an address.
			A jump&apos;s landing location can&apos;t be specified in the jump command itself, as the addresses are too long to fit in the command (Nisan &amp; Schocken).
			Commands are sixteen bits long, while addresses are fifteen bits long, so any operation involving a memory address must be preceded with an instruction to load that address into the A register where it can be accessed without taking up space in the command.
			(That is to say, one bit isn&apos;t enough space to specify all commands possible on the Hack platform, because the Hack platform supports more than two operations.
			A computer that can only perform one of two operations wouldn&apos;t be very versatile at all.)
		</p>
		<p>
			So what happens if a jump instruction involves a reference to M?
			The value in the A register is then used both as the address holding the value of M and as the jump&apos;s landing location.
			Except in very obscure, likely constructed cases, this behaviour would be unwanted, not to mention outright bizarre.
			There&apos;s no reason to believe that the memory address we want to access is in fact equal to the instruction address that we want to jump to.
			That&apos;d be one heck of a coincidence.
		</p>
		<h3>Research the concept of interrupts in a computer.</h3>
		<p>
			The discussion assignment says to research interrupts, but doesn&apos;t actually ask any questions about them.
			I&apos;m confused as to whether or not this is something we&apos;re supposed to discuss, and if it is, what about it we&apos;re supposed to discuss.
			The referenced $a[PDF] is 630 pages long, so there&apos;s definitely not time to read all that this week, and it&apos;s poorly constructed, so searching for information on interrupts in it is next to impossible.
			(The $a[PDF] is built out of images of text, rather than actual text, not only making the $a[PDF]&apos;s size monstrous, but also making the control + F feature fail.)
		</p>
		<p>
			My notes from past courses are in disarray due to censorship imposed on me by the university, so I&apos;m not quite sure which course it was in which I studied hardware interrupts.
			I think it was <span title="Operating Systems 1">CS 2301</span>.
			Even if I could find it in my notes though, I wouldn&apos;t be able cite it, as I&apos;ve been forced to take my notes down off the Web.
			In any case, if you&apos;ve taken whichever course it was, you should have some idea what interrupts are.
			Basically, a computer can typically only do one thing at a time.
			That means it can only run <strong>*one program*</strong> at a time.
			The operating system manages system resources, deciding when each program should be run on the $a[CPU].
			If the program plays nicely, it&apos;ll return control of the hardware to the operating system every once in a while.
			However, we can&apos;t assume that all programs will behave properly.
			A malicious or poorly-programmed program could refuse to or fail to return control to the operating system.
			In order to keep such programs from taking over the machine, a timer can be built into the hardware that halts the currently-executing program, returning control to the system.
			The system can then decide to either continue running the same program or switch to another program entirely.
		</p>
		<p>
			When the timer signals the hardware to interrupt the current task, a number of things take place.
			The state of the registers is saved to memory, for example.
			This is necessary, as each program will expect different values to be in the registers.
			If a program just loaded a particular value into a register, then got interrupted and another program loaded a new value into the register, the first program would see the wrong value when it tried to use the value in the register.
			After that, the operating system&apos;s interrupt trap handler is typically called.
			This is what allows the operating system to take control back and run whatever code it needs to.
			From there, it can restore the saved values back to the registers for whatever program it decided to run next, then it can begin running that program again; that program will be none the wiser that it was ever even halted.
		</p>
		<p>
			The intervals in which a program is able to be partially run are incredibly small and fast.
			You may think that you&apos;re running your Web browser, your text editor, your email client, your $a[IRC] client, your $a[XMPP] client, and your music player all at once, but you&apos;re not.
			The computer is rapidly switching between all these programs so quickly that you can&apos;t even tell that one has to be stopped before another can continue.
			This is accomplished, in part, by the magic of hardware interrupts.
			It&apos;d be possible without interrupts if the software would all play nicely and return control of the hardware to the system, of course.
			In the absence of such trust though, hardware interrupts make this dream a reality.
		</p>
		<div class="APA_references">
			<h3>References:</h3>
			<p>
				Nisan &amp; Schocken. (n.d.). Machine Language. Retrieved from <a href="https://my.uopeople.edu/mod/resource/view.php?id=132872"><code>https://my.uopeople.edu/mod/resource/view.php?id=132872</code></a>
			</p>
		</div>
	</blockquote>
	<p>
		I&apos;m not off to as great of a start as I could be, but I think I can succeed this week.
		At least, to the extent I&apos;d be able to succeed without the stupid holiday coming up.
		(By the time this journal entry is made available, my learning journal will be available too, so check that for details on what I mean about my chances of success being low.)
		I&apos;ve downloaded what I&apos;ll need to work on my two main assignments while I&apos;m away from home.
		I won&apos;t have a ton of time to myself during that period, but I figure I should have an hour or two to work each day.
		If not naturally, by request.
		If I get the main discussion posts finished before then, as well as the grading, all I&apos;ll have to do is work on the two projects.
		One project involves translating two small programs into machine language by hand.
		The other involves building a flowchart based on a program&apos;s code, then calculating the cyclomatic complexity of the program.
		Both will be a time-consuming pain, but I wouldn&apos;t call either difficult.
	</p>
</section>
END
);
